package com.ymatou.iapi.coupon.service;

import java.math.BigDecimal;

import net.sf.json.JSONObject;

import com.ymatou.iapi.coupon.parameter.batchInfos;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*获取用户已经使用的优惠券金额Call
*FreeMaker Template自动生成代码
*/
public class getUsedCouponAmountCall extends YmatouBaseCall{
	private static String opurl ="api/promotion/getUsedCouponAmount";
	
	public getUsedCouponAmountCall() {
		super(EnvSetup.getSystemUrl("couponiapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public String getStatusCode1()
    {
        return getString("statusCode");
    }
	
	public String getErrorMessage()
    {
        return getString("message");
    }
	
	
	  public String getUsedAmount()
	  {
	      String usedAmount="";
	        try {
	        	usedAmount = new BigDecimal(JSONObject.fromObject(getString("data").toString()).getString("usedAmount")).stripTrailingZeros().toPlainString();
	
	        } catch (Exception e) {
	            e.printStackTrace();
	        }
	        return usedAmount;
	    }
}